

#import <Foundation/Foundation.h>
#import <Security/Security.h>

/** Error codes that can be returned in NSError objects. */
typedef enum {
    /** No error. */
    UyeKeychainErrorNone = noErr,
    
    /** Some of the arguments were invalid. */
    UyeKeychainErrorBadArguments = -1001,
    
    /** There was no password. */
    UyeKeychainErrorNoPassword = -1002,
    
    /** One or more parameters passed internally were not valid. */
    UyeKeychainErrorInvalidParameter = errSecParam,
    
    /** Failed to allocate memory. */
    UyeKeychainErrorFailedToAllocated = errSecAllocate,
    
    /** No trust results are available. */
    UyeKeychainErrorNotAvailable = errSecNotAvailable,
    
    /** Authorization/Authentication failed. */
    UyeKeychainErrorAuthorizationFailed = errSecAuthFailed,
    
    /** The item already exists. */
    UyeKeychainErrorDuplicatedItem = errSecDuplicateItem,
    
    /** The item cannot be found.*/
    UyeKeychainErrorNotFound = errSecItemNotFound,
    
    /** Interaction with the Security Server is not allowed. */
    UyeKeychainErrorInteractionNotAllowed = errSecInteractionNotAllowed,
    
    /** Unable to decode the provided data. */
    UyeKeychainErrorFailedToDecode = errSecDecode
} UyeKeychainErrorCode;

extern NSString *const kUyeKeychainErrorDomain;

/** Account name. */
extern NSString *const kUyeKeychainAccountKey;

/**
 Time the item was created.
 
 The value will be a string.
 */
extern NSString *const kUyeKeychainCreatedAtKey;

/** Item class. */
extern NSString *const kUyeKeychainClassKey;

/** Item description. */
extern NSString *const kUyeKeychainDescriptionKey;

/** Item label. */
extern NSString *const kUyeKeychainLabelKey;

/** Time the item was last modified.
 
 The value will be a string.
 */
extern NSString *const kUyeKeychainLastModifiedKey;

/** Where the item was created. */
extern NSString *const kUyeKeychainWhereKey;


@interface UyeKeychain : NSObject


+ (NSArray *)GameHelpTotalAccounts;

+ (NSArray *)GameHelpTotalAccounts:(NSError **)error;
+ (NSArray *)GameHelpAccountsForService:(NSString *)serviceName;
+ (NSArray *)GameHelpAccountsForService:(NSString *)serviceName error:(NSError **)error;
+ (NSString *)GameHelpPasswordForService:(NSString *)serviceName account:(NSString *)account;
+ (NSString *)GameHelpPasswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
+ (NSData *)GameHelpPasswordDataForService:(NSString *)serviceName account:(NSString *)account;
+ (NSData *)GameHelpPasswordDataForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
+ (BOOL)GameHelpDeletePaswordForService:(NSString *)serviceName account:(NSString *)account;
+ (BOOL)GameHelpDeletePaswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
+ (BOOL)GameHelpSetPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account;
+ (BOOL)GameHelpSetPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
+ (BOOL)GameHelpSetPaswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account;

+ (BOOL)GameHelpSetPaswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;

#if __IPHONE_4_0 && TARGET_OS_IPHONE

+ (CFTypeRef)accessibilityType;

+ (void)GameHelpSetAccessibilityType:(CFTypeRef)accessibilityType;
#endif

@end
